The present invention relates to a video data compression apparatus, and a method of the same, for compressing and encoding pictures of expanded and decoded video data to pictures of the same type as that at the previous compression and encoding when for example dubbing video data by connecting in tandem video tape recorders (VTRs) which record video data compressed and encoded by an MPEG method or the like and expand and decode the reproduced video data for output.
In recent years, in the field of video data compression, frequent use has been made of the MPEG2 (Moving Picture Experts Group 2) method as a so-called MC-DCT method of improving an encoding efficiency by a combination of motion compensation (MC) processing and redundancy reduction processing by discrete cosine transfer (DCT) and other orthogonal transformation.
In this MPEG2 method, usually non-compressed video data is compressed and encoded in units of xe2x80x9cgroups of picturesxe2x80x9d (GOPs) each containing one intra-picture capable of being expanded and decoded without use of the pixel data of other pictures and predetermined numbers of predictive pictures (P pictures) to be expanded and decoded by using the pixel data of the previous picture and bidirectionally predictive pictures (B pictures) to be expanded and decoded by using the pixel data of the previous and following pictures.
Here, for example, when transmitting video data between television broadcasting stations or dubbing video data by using a plurality of video tape recorders (VTRs), in order to expand and decode the video data which has been already compressed and encoded by the MPEG2 method and then compress and encode the same again, it is necessary to connecting a compression and encoding apparatus (encoder) and an expansion and decoding apparatus (decoder) in series (tandem connection).
When repeating this compression and encoding and this expansion and decoding of the video data in this way by repeatedly connecting in tandem the encoder and the decoder, the quality of the video deteriorates. Particularly, television broadcasting station facilities and other industrial use systems require a high video quality, so prevention of deterioration of the video quality along with the compression and encoding and the expansion and decoding by a tandem-connected encoder and decoder is strictly required.
In order to minimize the deterioration of the video quality occurring in the tandem-connected encoder and decoder, it is necessary to make the quantization steps used in the compression and encoding and the expansion and decoding the same. The quantization steps must also be held together with the compressed video data.
When performing compression and encoding without performing motion compensation processing, as disclosed in for example Japanese Unexamined Patent Publication (Kokai) No. 5-284458 (related U.S. Pat. No. 5,389,973) and Japanese Unexamined Patent Publication (Kokai) No. 6-319112, by using the superior xe2x80x9cback searchxe2x80x9d method of utilizing the property that the sum of the remainders of the DCT coefficients becomes the relative minimum when using the quantization step used in the previous compression and encoding or the quantization step of a multiple of the same and searching for the quantization step giving the smallest relative minimum as the optimum quantization step, it is possible to make the quantization steps equal between the time of compression and encoding and the time of expansion and decoding and thus prevent the deterioration of the video quality.
However, in a case where the GOP is of a 2-frame structure containing one intra-picture and one B picture or a case where the GOP is of a 15-frame structure, in order to suppress the deterioration of the video quality at the time of tandem connection, rather than matching the quantization steps, it is first more important to compress and encode the same pictures to the same type of pictures (picture types) each time, that is, to match phases of GOPs in each compression and encoding.
When the GOPs are out of phase, the above back search method can no longer be used. In addition, the same pictures end up being compressed and encoded to different picture types, for example, a picture expanded and decoded from a B picture or a P picture is compressed and encoded to an intra-picture. A large amount of the video information is consequently lost with each compression and encoding and the quality of picture is greatly deteriorated.
In order to deal with such a problem, as disclosed in for example Japanese Unexamined Patent Publication (Kokai) No. 6-284414 (related to U.S. Pat. No. 08/477,855), the method may be considered of multiplexing and outputting the picture type and the decoded video data at the time of expansion and decoding and having the encoder perform the compression and encoding by matching the phases of the GOPs by referring to the multiplexed picture type.
According to the method disclosed in Japanese Unexamined Patent Publication (Kokai) No. 6-284414, however, the information of the picture type ends up being multiplexed on a part of the video data other than the valid pixels. When, for example, there are operation desks (switchers) of television broadcasting stations or digital VTRs etc. of different systems between the tandem connected encoder and decoder, there is a possibility in that the information of the picture type will be lost due to blanking or the like.
When the information of the picture type is lost or the information of the picture type is replaced by other information or random data in this way, there is a possibility that the next encoder will erroneously detect the random data etc. as the information of the picture type, encode by the wrong picture type, and conversely cause a greater deterioration of the quality of the video.
The present invention was made so as to solve the above problem and has as an object thereof to provide a video data compression apparatus capable of automatically detecting the picture type of the previous time of compression and encoding at the encoder side and performing the compression and encoding by matching the GOPs in phase even if information of the picture type is not particularly multiplexed on the video pixel data, and a method of the same.
The video data compression apparatus according to the present invention compresses an intra-picture detecting means for detecting a picture compressed and encoded to an intra-picture in the previous compression processing among pictures of video data obtained by expanding video data which was compressed the previous time to a combination of intra-pictures and non-intra-pictures; a picture type judging means for judging to which picture type between an intra-picture and a non-intra-picture each of the pictures of the video data was compressed to in the compression processing based on an interval of detected intra-pictures; and a video data compressing means for compressing each of the pictures of the video data to the same picture type as that in the previous compression processing.
Preferably, in the video data compression apparatus, the intra-picture detecting means compresses an orthogonal transforming means for orthogonally transforming each of the pictures of the video data for every macroblock to generate orthogonally transformed data; a dividing means for dividing the orthogonally transformed data for every macroblock of each of the pictures of the video data generated by the orthogonal transforming means by each of a plurality of quantization steps; a remainder sum calculating means for calculating the sum of the remainders of the results of division by the plurality of quantization steps generated by the dividing means of the orthogonally transformed data for every macroblock of each of the pictures of the video data; and a detecting means for detecting whether or not a picture of the video data was compressed and encoded to an intra-picture in the previous compression processing based on whether or not there is a relative minimum of the sum of the remainders.
Preferably, the intra-picture detecting means of the video data compression apparatus compresses an orthogonal transforming means for orthogonally transforming part of the macroblocks of each of pictures of the video data to generate orthogonally transformed data; a dividing means for dividing the orthogonally transformed data of part of the macroblocks of each of the pictures of the video data generated by the orthogonal transforming means by each of the plurality of quantization steps; a remainder sum calculating means for calculating the sum of the remainders of each of the results of division by the plurality of quantization steps by the dividing means of the orthogonally transformed data of part of the macroblocks of each of pictures of the video data; and a detecting means for detecting whether or not a picture of the video data was compressed and encoded to an intra-picture in the previous compression processing based on whether or not there is a relative minimum of the sum of remainders.
Preferably, the intra-picture detecting means of the video data compression apparatus compresses a quantization step selecting means for selecting the quantization step giving the smallest relative minimum of the sum of remainders; and the video data compressing means has a quantizing means for quantizing the video data by using the selected quantization step.
Preferably, the intra-picture detecting means of the video data compression apparatus detects a picture compressed and encoded to an intra-picture in the previous compression processing before the video data compressing means compresses the video data.
Further, the video data compression apparatus of the present invention compresses a compression processing discriminating means for discriminating whether or not the input video data has gone through compression processing in the past; a quantization step generating means for reproducing the quantization step in the compression processing to generate a first quantization step when it is discriminated that the input video data has gone through compression processing in the past and generating a predetermined second quantization step when it is discriminated that the input video data has not gone through compression processing; and a video data compressing means for compressing the input video data by using the generated first quantization step or second quantization step.
Preferably, the quantization step generating means of the video data compression apparatus compresses an orthogonal transforming means for orthogonally transforming each of the pictures of the video data for every macroblock to generate orthogonally transformed data; a dividing means for dividing the orthogonally transformed data for every macroblock of each of the pictures of the generated video data by each of the plurality of quantization steps; a remainder sum calculating means for calculating the sum of the remainders of each of the results of division of the orthogonally transformed data for every macroblock of each of the pictures of the video data by the plurality of quantization steps; and a determining means for determining the quantization step giving the smallest relative minimum of the sum of remainders as the first quantization step.
Preferably, the video data compression apparatus further compresses a picture type discriminating means for discriminating to which picture type of an intra-picture or non-intra-picture each of the pictures of the input video data was compressed to in the compression processing when the input video data has gone through compression processing for generating intra-pictures and non-intra-pictures; and the video data compressing means compresses each of the pictures of the input compressed video data to the same picture type as that in the compression processing when the input video data has gone through compression processing for generating the intra-pictures and non-intra-pictures after compression.
Preferably, the discriminating means of the video data compression apparatus discriminates whether or not the input video data has gone through compression processing by comparing the sum of remainders and a predetermined threshold and further has a threshold adjusting means for adjusting a threshold in accordance with which picture type of an intra-picture or non-intra-picture each of the pictures of the input video data was compressed to in the compression processing.
Preferably, the quantization step generating means of the video data compression apparatus generates a second quantization step only in a case where the order of picture types of the input video data input in the previous compression processing satisfies a predetermined condition.